<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/layui/css/layui.css" media="all">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>

<script src="/layui/layui.js" charset="utf-8"></script>
<!-- 注意：如果你直接复制所有代码到本地，上述 JS 路径需要改成你本地的 -->
<body>

<form class="layui-form" action="/goodsClass/addGoodsClass">

    <!--    <div class="layui-form-item">-->
    <!--        <label class="layui-form-label">用户账号</label>-->
    <!--        <div class="layui-input-block">-->
    <!--            <input id="id" type="text" name="id" width="80" lay-verify="title" autocomplete="off"-->
    <!--                   class="layui-input">-->
    <!--        </div>-->
    <!--    </div>-->
    <br>
    <br>
    <br>

    <div class="layui-form-item">
        <label class="layui-form-label">新增商品名</label>
        <div class="layui-input-block">
            <input id="className" type="text" name="className" width="80" lay-verify="title" autocomplete="off"
                   class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>

<script>
    //Demo
    layui.use('form', function () {
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function (data) {
            // 把表单的数据转化为json对象，并提交
            layer.msg(JSON.stringify(data.field));
            return true;// true表示表示执行action对应的地址
        });
    });
</script>

</body>
</html>